{literal}
<script language="JavaScript" type="text/JavaScript">
function cambiar(esto)
{
	vista=document.getElementById(esto).style.display;
	if (vista=='none')
		vista='block';
	else
		vista='none';

	document.getElementById(esto).style.display = vista;
}
function elegirForm(form){
   switch (form){
     case "agregar":
	      if(document.getElementById("lista").style.display == 'block'){
		    cambiar("lista");
		  }
		  if(document.getElementById("editar").style.display == 'block'){
		    cambiar("editar");
		  }	
		  document.getElementById('seturl').value = "";
		  cambiar("agregar");
		  break;
     case "lista":
          if(document.getElementById("agregar").style.display == 'block'){
		    cambiar("agregar");
		  }
		  if(document.getElementById("editar").style.display == 'block'){
		    cambiar("editar");
		  }	
		  document.getElementById('seturl').value = "";
		  cambiar("lista");
          break;
     		  
   }
}
function formEditar(categoria, estado, privacidad, url, cid){
 
  document.getElementById('seturl').value = "";
  cambiar("lista");
  cambiar("editar");
  
  document.feditar.category.value=categoria;
  
  if(estado == '1'){
  document.getElementById('activo').checked='checked';
  }else{
  document.getElementById('inactivo').checked='checked';
  }
  
  if(privacidad == 'pub'){
  document.getElementById('pu').selected='selected';
  }else{
  document.getElementById('pr').selected='selected';
  }
  
  document.feditar.editUrl.value = url ;
  document.feditar.cid.value = cid;
}
function urls(url){
     document.getElementById('seturl').value = url;
   }
</script>
{/literal}

<table  style="BORDER-RIGHT:#999 1px solid; border-bottom:#999 1px solid; border-left:#999 1px solid; 
        border-top:#999 1px solid;" width="953" align="center"    border="0" cellpadding="0" cellspacing="0">
  <!--DWLayoutTable-->
  <tr>
    <td height="19" colspan="2" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
      <!--DWLayoutTable-->
      <tr>
        <td width="20" height="19" valign="top" bgcolor="#333333" style="border-bottom:#999999 2px solid;"><!--DWLayoutEmptyCell-->&nbsp;</td>
          <td width="644" valign="middle" bgcolor="#333333" style="border-bottom:#999999 2px solid;" class="style2">Categorias</td>
          <td width="268" valign="middle" align="right" bgcolor="#333333" style="border-bottom:#999999 2px solid;" class="style2"><a href="{$conf.html}/index.php" class="blanco">[
          Pagina Principal ]</a></td>
          <td bgcolor="#333333" style="border-bottom:#999999 2px solid;" width="19" valign="top"><!--DWLayoutEmptyCell-->&nbsp;</td>
        </tr>
    </table></td>
  </tr>
  <tr>
    <td  width="14" height="186" valign="top" ><!--DWLayoutEmptyCell-->&nbsp;</td>
    <td width="937" valign="top"><table  width="100%" border="0" cellpadding="0" cellspacing="0">
      <!--DWLayoutTable-->
      <tr>
        <td width="438" height="85" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
          <!--DWLayoutTable-->
          <tr>
            <td width="204" height="22">&nbsp;</td>
                <td width="188">&nbsp;</td>
                <td width="46">&nbsp;</td>
              </tr>
          <tr>
            <td height="30" valign="top"><input type="button" name="agre" value="Agregar Categorias" onClick="elegirForm('agregar')" ></td>
                <td valign="top"><input type="button" name="edi" value="Lista de Categorias" onClick="elegirForm('lista')"></td>
                <td valign="middle" align="right"><strong>Url</strong>&nbsp;</td>
              </tr>
          <tr>
            <td height="33">&nbsp;</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
              </tr>
          
          </table>        </td>
          <td width="499" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
              <!--DWLayoutTable-->
              <tr>
                <td width="432" height="22">&nbsp;</td>
                <td width="67">&nbsp;</td>
              </tr>
              <tr>
                <td height="30" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
                  <!--DWLayoutTable-->
                  <tr>
                    <td width="436" height="30" valign="middle"><input class="style44" id="seturl" style="border:0px; background:#CCCCCC;" size="80" type="text" value="" readonly></td>
                    </tr>
                  </table></td>
                <td>&nbsp;</td>
              </tr>
              <tr>
                <td height="33">&nbsp;</td>
                <td>&nbsp;</td>
              </tr>
              
              
          </table></td>
        </tr>
      
      <tr>
        <td height="0" colspan="2" valign="top">
          <div id="lista" style="display: block;">
            <table width="100%" border="0" cellpadding="0" cellspacing="0">
              <!--DWLayoutTable-->
              <tr>
                <td  width="482" height="59"  valign="top"><table width="100%"  class="centro"  border="1" bordercolor="#999999" cellpadding="1" cellspacing="2">
                  <!--DWLayoutTable-->
                  <tr>
                    <td width="184" height="27" valign="middle"><strong>Categorias</strong></td>
                        <td width="55" valign="middle"><strong>Estado</strong></td>
                        <td width="77" valign="middle"><strong>Privacidad</strong></td>
                        <td width="49" valign="middle"><strong>Url</strong></td>
                        <td width="83" valign="middle"><strong>Editar</strong></td>
                      </tr>
					  {section name="ac" loop=$category.cid}
                  <tr>
                    <td height="27" valign="middle">{$category.category[ac]}</td>
                        <td valign="middle">{if $category.active[ac] == 1}activo{else}Inactivo{/if}</td>
                        <td valign="middle">{if $category.exit[ac] == 'pub'}Publica{else}Privada{/if}</td>
                        <td valign="middle"><a href="#" onclick="urls('{$conf.html}/survey.php?ccat={$category.cid[ac]}')"><img src="{$conf.images_html}/url2.gif" name="urldep" width="18" height="17" border="0"  title="indica la direccion para publicar la ultima encuesta creada de esta categoria" /></a></td>
						
                        <td valign="middle"><input type="button" name="dep" value="Editar"  class="boton2" onClick="formEditar('{$category.category[ac]}','{$category.active[ac]}','{$category.exit[ac]}','{$conf.html}/survey.php?ccat={$category.cid[ac]}', '{$category.cid[ac]}')"/></td>
                 </tr>
                  {/section}
                  
                  </table></td>
                  <td width="455">&nbsp;</td>
                </tr>
              </table>
          </div>		  </td>
        </tr>
      <tr>
        <td height="0" colspan="2" valign="top">
          <div id="editar" style="display: none;">
            <table width="100%" border="0" cellpadding="0" cellspacing="0">
              <!--DWLayoutTable-->
              <form name="feditar" method="post" action="{$conf.html}/edit_category.php">
                
                <tr>
                  <td width="460" height="263" valign="top"><table bgcolor="#CCCCCC" width="100%" border="0" cellpadding="0" cellspacing="0">
                    <!--DWLayoutTable-->
                    <tr>
                      <td height="24" colspan="2" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
                        <!--DWLayoutTable-->
                        <tr>
                          <td bgcolor="#EBEBEB" width="10" height="24" valign="top"><!--DWLayoutEmptyCell-->&nbsp;</td>
                                <td bgcolor="#EBEBEB" width="450" valign="middle"><strong>Editar Categoria</strong>
                                  <input type="hidden" name="mode" value="{$data.mode}">
                                  <input type="hidden" name="sid" value="{$data.sid}">
                                <input type="hidden" name="cid" value="">								</td>
                              </tr>
                        </table></td>
                        </tr>
                    <tr>
                      <td width="10" height="239" valign="top"><!--DWLayoutEmptyCell-->&nbsp;</td>
                          <td width="450" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
                              <!--DWLayoutTable-->
                              <tr>
                                <td width="22" height="13"></td>
                                <td width="45"></td>
                                <td width="22"></td>
                                <td width="17"></td>
                                <td width="17"></td>
                                <td width="14"></td>
                                <td width="26"></td>
                                <td width="287"></td>
                              </tr>
                              <tr>
                                <td height="16" colspan="4" valign="bottom"><strong>Categoria</strong></td>
                                <td></td>
                                <td></td>
                                <td></td>
                                <td></td>
                              </tr>
                              <tr>
                                <td height="28" colspan="7" valign="top"><input type="text" name="category"></td>
                                <td></td>
                              </tr>
                              <tr>
                                <td height="5"></td>
                                <td></td>
                                <td></td>
                                <td></td>
                                <td></td>
                                <td></td>
                                <td></td>
                                <td></td>
                              </tr>
                              <tr>
                                <td height="17" colspan="4" valign="bottom"><strong>Url</strong></td>
                                <td></td>
                                <td></td>
                                <td></td>
                                <td></td>
                              </tr>
                              <tr>
                                <td height="23" colspan="8" valign="top"><input class="style44" name="editUrl" style="border:0px; background:#CCCCCC;" size="85" type="text" readonly ></td>
                              </tr>
                              <tr>
                                <td height="5"></td>
                                <td></td>
                                <td></td>
                                <td></td>
                                <td></td>
                                <td></td>
                                <td></td>
                                <td></td>
                              </tr>
                             
                              <tr>
                                <td height="19" colspan="5" valign="bottom"><strong>Estado</strong></td>
                                <td>&nbsp;</td>
                                <td></td>
                                <td></td>
                              </tr>
                              
                              
                              <tr>
                                <td height="20" valign="middle"><input name="active" value="1" id="activo" type="radio"  /></td>
                                <td valign="middle">Activo</td>
                                <td valign="middle"><input name="active" value="0" type="radio"  id="inactivo" /></td>
                                <td colspan="3" valign="middle">Inactivo</td>
                                <td></td>
                                <td></td>
                              </tr>
                              <tr>
                                <td height="5"></td>
                                <td></td>
                                <td></td>
                                <td></td>
                                <td></td>
                                <td></td>
                                <td></td>
                                <td></td>
                              </tr>
                              <tr>
                                <td height="19" colspan="6" valign="bottom"><strong>Privacidad</strong></td>
                                <td></td>
                                <td></td>
                              </tr>
                            
                              <tr>
                                <td height="29" colspan="7" valign="top"><select name="salida">
                                    <option value="pub" id="pu" >Publica</option>
                                    <option value="pri" id="pr">Privada</option>
                                </select>                                  							  </td>
                                <td></td>
                              </tr>
                              <tr>
                                <td height="32" colspan="8" valign="middle" align="center"><input type="submit" name="btn_edit" value="Editar" /></td>
                              </tr>
                              <tr>
                                <td height="8"></td>
                                <td></td>
                                <td></td>
                                <td></td>
                                <td></td>
                                <td></td>
                                <td></td>
                                <td></td>
                              </tr>
                     
                          </table></td>
                        </tr>
                   
                    </table></td>
                    <td width="477">&nbsp;</td>
                  </tr>
                </form>
              </table>
          </div>		  </td>
        </tr>
      <tr>
        <td height="0" colspan="2" valign="top">
          <div id="agregar" style="display: none;">
            <table width="100%" border="0" cellpadding="0" cellspacing="0">
             <form name="agregar" method="POST" action="{$conf.html}/add_category.php">
              <tr>
                <td width="460" height="224" valign="top"><table bgcolor="#CCCCCC" width="100%" border="0" cellpadding="0" cellspacing="0">
                  <!--DWLayoutTable-->
                  <tr>
                    <td height="24" colspan="2" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
                      <!--DWLayoutTable-->
                      <tr>
                        <td width="10" height="24" valign="top" bgcolor="#EBEBEB"><!--DWLayoutEmptyCell-->&nbsp;</td>
                              <td width="450" valign="middle" bgcolor="#EBEBEB"><strong>Agregar Categoria </strong></td>
                            </tr>
                      </table></td>
                      </tr>
                  <tr>
                    <td width="10" height="200" valign="top"><!--DWLayoutEmptyCell-->&nbsp;</td>
                        <td width="450" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
                            <!--DWLayoutTable-->
                            <tr>
                              <td width="22" height="18"></td>
                              <td width="45"></td>
                              <td width="22"></td>
                              <td width="40"></td>
                              <td width="8"></td>
                              <td width="5"></td>
                              <td width="46"></td>
                              <td width="262"></td>
                            </tr>
                            <tr>
                              <td height="20" colspan="6" valign="bottom"><strong>Nombre de Categoria </strong></td>
                              <td></td>
                              <td></td>
                            </tr>
                            <tr>
                              <td height="24" colspan="7" valign="top"><input type="text" name="category" /></td>
                              <td>&nbsp;</td>
                            </tr>
                            <tr>
                              <td height="13"></td>
                              <td></td>
                              <td></td>
                              <td></td>
                              <td></td>
                              <td></td>
                              <td></td>
                              <td></td>
                            </tr>
                            <tr>
                              <td height="19" colspan="6" valign="top"><strong>Estado</strong></td>
                              <td></td>
                              <td></td>
                            </tr>
                            <tr>
                              <td height="20" valign="top"><input type="radio" name="active" value="1"></td>
                              <td valign="middle">Activo</td>
                              <td valign="top"><input type="radio" name="active" value="0"></td>
                              <td colspan="2" valign="middle">Inactivo</td>
                              <td>&nbsp;</td>
                              <td>&nbsp;</td>
                              <td></td>
                            </tr>
                            <tr>
                              <td height="16"></td>
                              <td></td>
                              <td></td>
                              <td></td>
                              <td></td>
                              <td></td>
                              <td></td>
                              <td></td>
                            </tr>
                            <tr>
                              <td height="19" colspan="4" valign="top" title="se elige publica para estar habilitada al publico en general"><strong>Privacidad</strong></td>
                              <td>&nbsp;</td>
                              <td></td>
                              <td></td>
                              <td></td>
                            </tr>
                            <tr>
                              <td height="31" colspan="7" valign="top"><select name="select">
                                <option value="pub" selected="selected">Publica</option>
                                <option value="pri">Privada</option>
                              </select>							    							  </td>
                              <td></td>
                            </tr>
                            <tr>
                              <td height="30" colspan="8" align="center" valign="middle"><input type="submit" name="add_category" value="agregar" /></td>
                            </tr>
                            <tr>
                              <td height="9"></td>
                              <td></td>
                              <td></td>
                              <td></td>
                              <td></td>
                              <td></td>
                              <td></td>
                              <td></td>
                            </tr>
                       
                        </table></td>
                      </tr>
                  <tr>
                    <td height="0"></td>
                        <td></td>
                      </tr>
                  
                  </table></td>
                  <td width="477">&nbsp;</td>
                </tr>
				</form>
              </table>
			
          </div></td>
        </tr>
      <tr>
        <td height="39">&nbsp;</td>
          <td></td>
        </tr>
  
    </table></td>
  </tr>
  
  <tr>
    <td height="26" colspan="2" valign="top" ><table style="border-top:#999 1px solid;"  width="100%" border="0" cellpadding="0" cellspacing="0">
      <!--DWLayoutTable-->
      <tr>
        <td height="26" align="center" valign="middle" bgcolor="#EBEBEB" style="border-top:#D7D7D7 2px solid; border-bottom:#D7D7D7 2px solid;"><strong> <a href="{$conf.html}/index.php" class="negro">[
           Pagina Principal]</a></strong></td>
        </tr>
    </table></td>
  </tr>
</table>